import http from "@/utils/http";
import {GW} from "@/common/const";

/**
 * 股权质押-质押方分布统计
 * @param {Object} option
 * @param {String,Optional} option.type - 券商信托	质押方类型-非必传,缺省:券商信托
 * @param {String, Optional} option.field -
 * @param {String, Optional} option.sort -  升降序:asc/desc 缺省:desc
 * @param {Number, Optional} option.pageNo -  页码
 * @param {Number, Optional} option.pageSize - 每页数量
 *
 * @return {Promise} Array
 */
export async function organization(option) {
  const url = `${GW}/gw/ynstockinfo/client/pledge/organization`;
  const params = {
    pageNo: 1,
    ...option,
  };
  return http.get(url,  params );
  
}

/**
 * 股权质押-分页-市场概况&质押比例&重要股东
 * @param {Object} option
 * @param {String} option.type - 模块类型:brief-概况|rate-比例|holder-股东 三个值可选(与列表返回的三个key对应)
 * @param {String,Optional} option.field - 非必填-根据类型和产品原型上的默认值
 * @param {String, Optional} option.sort -  升降序:asc/desc 缺省:desc
 * @param {Number, Optional} option.pageNo -  页码
 * @param {Number, Optional} option.pageSize - 每页数量
 * @return {Promise} Array
 */
export function getPage(type, option) {
  const url = `${GW}/gw/ynstockinfo/client/pledge/page/${type}`;
  const params = {
    pageNo: 1,
    pageSize: 10,
    ...option,
  };
  return http.get(url,  params );
}

/**
 * 股权质押-列表-市场概况&质押比例&重要股东
 * @return {Promise} Array
 */
export function getList(option) {
  const url = `${GW}/gw/ynstockinfo/client/pledge/list`;
  const params = {
    ...option,
  };
  return http.get(url,params);
  
}

/**
 * 股权质押-质押走势折线图&比例柱状图
 * @param {Object} option
 * @return {Promise} Array
 */
export function getChart(option) {
  const url = `${GW}/gw/ynstockinfo/client/pledge/chart`;
  const params = {
    ...option,
  };
  return http.get(url,params);
  
}
